<?xml version="1.0" encoding="UTF-8"?>
<!--
  Created by IntelliJ IDEA.
  User: lukman
  Date: 6/24/11
  Time: 11:54 AM
-->
<!DOCTYPE html
        PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:ui="http://java.sun.com/jsf/facelets">

<head>
    <title>User</title>
</head>
<f:metadata>
    <f:viewParam name="id" value="#{anasitUserBean.anasitUser.id}"/>
    <f:viewParam name="firstname" value="#{anasitUserBean.anasitUser.name.firstName}"/>
    <f:viewParam name="middlename" value="#{anasitUserBean.anasitUser.name.middleName}"/>
    <f:viewParam name="lastname" value="#{anasitUserBean.anasitUser.name.lastName}"/>
    <f:viewParam name="role" value="#{anasitUserBean.anasitUser.role.role}"/>
    <f:viewParam name="username" value="#{anasitUserBean.anasitUser.userName}"/>
</f:metadata>

<body>
<ui:composition template="/resources/template/yiiTwoColtemplate.xhtml">
    <p:tooltip hideEffect="grow" global="true"/>
    <ui:define name="contentpart">
        <div id="content">
            <p:panel header="Create User" id="createPanel">
                <h:form id="create">
                    <p:growl id="formMessage"/>

                    <h:panelGrid id="grid1" columns="2">

                        <h:outputText value="#{msgs.firstName}"/>

                        <p:inputText value="#{anasitUserBean.anasitUser.name.firstName}" id="firstname"
                                     title="Specify your firstname" requiredMessage="Enter first name" required="true"/>


                        <h:outputText value="#{msgs.middleName}"/>

                        <p:inputText value="#{anasitUserBean.anasitUser.name.middleName}" id="middlename"
                                     title="Specify your middle name" requiredMessage="Enter middle name"
                                     required="true"/>


                        <h:outputText value="#{msgs.lastName}"/>
                        <p:inputText value="#{anasitUserBean.anasitUser.name.lastName}" id="lastname"
                                     title="Specify your lastname" requiredMessage="Enter last name" required="true"/>

                        <h:outputText value="#{msgs.userRole}"/>
                        <h:selectOneMenu id="role" title="Select a role" value="#{anasitUserBean.anasitUser.role.role}">
                            <f:selectItem itemValue="user" itemLabel="User"/>
                            <f:selectItem itemValue="nurse" itemLabel="Nurse"/>
                            <f:selectItem itemValue="doctor" itemLabel="Doctor"/>
                            <f:selectItem itemValue="admin" itemLabel="Admin"/>

                        </h:selectOneMenu>


                        <h:outputText value="#{msgs.userName}"/>
                        <p:inputText title="Username to login " value="#{anasitUserBean.anasitUser.userName}"
                                     validatorMessage="Your Username is needed"
                                     id="username" required="true" requiredMessage="Your Username is needed"/>


                        <h:outputText value="#{msgs.userPassword}"/>
                        <p:password value="#{anasitUserBean.anasitUser.passString}" id="passwd" minLength="6"
                                    feedback="true"/>

                        <h:outputText value="#{msgs.emptyword}"/>
                        <h:panelGroup>
                            <p:commandButton value="#{msgs.Savebutton}" update="formMessage"
                                             action="#{anasitUserBean.createAnasitUser}"/>
                            <p:commandButton value="#{msgs.Cancelbutton}" immediate="true"
                                             action="#{anasitUserBean.clearAnasitUserProperties}"/>
                        </h:panelGroup>


                    </h:panelGrid>
                </h:form>
            </p:panel>
        </div>
    </ui:define>
    <ui:define name="operationspart">
        <h:form>
            <p:menu>
                <p:submenu label="User Operations">
                    <p:menuitem value="View all Users" url="users.xhtml"/>
                    <p:menuitem value="Manage Users" url="manage.xhtml"/>
                </p:submenu>
            </p:menu>
        </h:form>
    </ui:define>
</ui:composition>
</body>

</html>